package com.code.mqListener;

import com.code.bean.Employee;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

/**
 * RabbitMQ消费者
 *
 * @author wangjie
 * @version V1.0
 * @date 2020/2/19
 */
public class MQConsumer {

    @RabbitListener(queues = "code.news")
    public void receive(Employee employee){
        System.out.println("收到消息："+employee);
    }

    @RabbitListener(queues = "test")
    public void receive02(Message message){
        System.out.println(message.getBody());
        System.out.println(message.getMessageProperties());
    }
}
